/**
 * @file
 * GDB debug support.
 */
#ifndef GDB_DEBUG_SUPPORT_H
#define GDB_DEBUG_SUPPORT_H

#include <iostream>

#include <list>
#include <map>

#include "expansion_graph_instance.h"
#include "string_vertex_edge.h"


bool actual_invocation;

void dp(std::list<ExpansionGraphInstance<StringVertexEdge, StringVertexEdge>* > given)
{
  if (! actual_invocation) return;

  for(std::list<ExpansionGraphInstance<StringVertexEdge, StringVertexEdge>* >::iterator i = given.begin();
      i != given.end();
      i++)
    {
      std::cerr << "\n";
      (*i)->print();
    }
}

void dp(std::map<StringVertexEdge*, StringVertexEdge* > given)
{
  if (! actual_invocation) return;

  for(std::map<StringVertexEdge*, StringVertexEdge*>::iterator i = given.begin();
      i != given.end();
      i++)
    {
      std::cerr << "\n";
      (i->first)->print();
      (i->second)->print();
    }
}

void dp(std::multimap<StringVertexEdge*, StringVertexEdge* > given)
{
  if (! actual_invocation) return;

  for(std::multimap<StringVertexEdge*, StringVertexEdge*>::iterator i = given.begin();
      i != given.end();
      i++)
    {
      std::cerr << "\n";
      (i->first)->print();
      (i->second)->print();
    }
}

void call_dp()
{
  actual_invocation = false;

  std::list<ExpansionGraphInstance<StringVertexEdge, StringVertexEdge>* > egi;
  dp(egi);

  std::map<StringVertexEdge*, StringVertexEdge*> expansions;
  dp(expansions);

  std::multimap<StringVertexEdge*, StringVertexEdge*> mapping;
  dp(mapping);

   actual_invocation = true; 
}

#endif // GDB_DEBUG_SUPPORT_H
